package com.example.controller;

import com.example.common.Result;
import com.example.entity.AirQualitySensor;
import com.example.entity.CoSensor;
import com.example.entity.FlameSensor;
import com.example.entity.Params;
import com.example.service.CoSensorService;
import com.example.service.FlameSensorService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ResponseBody
@RestController
@CrossOrigin
@RequestMapping("/FS")
public class FlameSensorController {

    @Resource
    private FlameSensorService flameSensorService;


    @GetMapping("/getSensorData")
    public Result getSensorData(Params params) {
        PageInfo<FlameSensor> search = flameSensorService.getSensorData(params);
        return Result.success(search);
    }

    @PostMapping("/addFS")
    public Result addFS(@RequestBody FlameSensor flameSensor) {
        flameSensorService.addFS(flameSensor);
        return Result.success();
    }

    @DeleteMapping("/deleteFS/{id}")
    public Result deleteFS(@PathVariable Long id) {
        flameSensorService.deleteFS(id);
        return Result.success();
    }
}
